import { BasicLayout, UserLayout } from '@/layouts';

const RouteView = {
  name: 'RouteView',
  render: (h) => h('router-view')
};

export const constantRouterMap = [
  {
    path: '/user',
    name: 'user',
    component: UserLayout,
    children: [
      {
        path: '/user/login',
        name: 'login',
        component: () => import('@/views/user/login/Login')
      },
      {
        path: '/user/register',
        name: 'register',
        component: () => import('@/views/user/register/Register')
      },
      {
        path: '/user/retrieve',
        name: 'RetrievePassWord',
        component: () => import('@/views/user/retrieve/Index')
      },
      {
        path: '/user/retrieve/submit',
        name: 'SubmitRetrievePassWord',
        component: () => import('@/views/user/retrieve/submit/Index')
      }
    ]
  },
  {
    path: '/404',
    component: () => import(/* webpackChunkName: "fail" */ '@/views/exception/404')
  }
];

export const asyncRouterMap = [
  {
    path: '/',
    name: 'index',
    component: BasicLayout,
    meta: { title: 'menu.home', breadcrumb: false },
    redirect: '/dashboard/home',
    children: [
      // dashboard
      {
        path: '/dashboard',
        name: 'home',
        redirect: '/dashboard/home',
        component: RouteView,
        meta: {
          title: 'home', keepAlive: true, icon: 'dashboard', permission: ['dashboard']
        },
        children: [
          // loan
          {
            path: '/dashboard/home',
            name: 'dashboard',
            component: () => import('@/views/dashboard/Index.vue'),
            meta: {
              title: 'home', keepAlive: false, permission: ['dashboard'], breadcrumb: false, hideBreadcrumb: true
            }
          },
          {
            path: '/dashboard/loan-application/:tid',
            name: 'LoanApplication',
            component: () => import('@/views/dashboard/process/loan/Index.vue'),
            meta: { title: 'Loan application', keepAlive: false, permission: ['dashboard'] }
          },

          // repayment
          {
            path: '/dashboard/repayment-application/:tid',
            name: 'RepaymentApplication',
            component: () => import('@/views/dashboard/process/repayment/Index.vue'),
            meta: { title: 'Repayment application', keepAlive: false, permission: ['dashboard'] }
          },
          {
            path: '/dashboard/repayment-details/:tid',
            name: 'RepaymentDetails',
            component: () => import('@/views/dashboard/process/repayment/Settlement.vue'),
            meta: { title: 'Repayment application', keepAlive: false, permission: ['dashboard'] }
          },
          {
            path: '/dashboard/repayment-details/:tid/:tr_id/result',
            name: 'RepaymentResult',
            component: () => import('@/views/dashboard/process/repayment/Result.vue'),
            meta: { title: 'Repayment details', keepAlive: false, permission: ['dashboard'] }
          }
        ]
      }
      // {
      //   path: '/form',
      //   name: 'form',
      //   meta: {
      //     keepAlive: true,
      //     title: 'menu.form.default',
      //     icon: 'video-camera',
      //   },
      //   component: RouteView,
      //   children: [
      //     {
      //       path: '/form/basic-form',
      //       name: 'basic-form',
      //       meta: {
      //         keepAlive: true,
      //         icon: 'smile',
      //         title: 'menu.form.basicform',
      //       },
      //       component: () => import(/* webpackChunkName: "about" */ '../views/form/basic-form'),
      //     },
      //     {
      //       path: '/form/step-form',
      //       name: 'step-form',
      //       meta: {
      //         keepAlive: true,
      //         icon: 'smile',
      //         title: 'menu.form.stepform',
      //       },
      //       component: () => import(/* webpackChunkName: "about" */ '../views/form/step-form'),
      //     },
      //     {
      //       path: '/form/advanced-form',
      //       name: 'advanced-form',
      //       meta: {
      //         keepAlive: true,
      //         icon: 'smile',
      //         title: 'menu.form.advancedform',
      //       },
      //       component: () => import(/* webpackChunkName: "about" */ '../views/form/advanced-form'),
      //     },
      //   ],
      // },
    ]
  },
  // account
  {
    path: '/account',
    component: BasicLayout,
    redirect: '/account/settings',
    name: 'account',
    meta: {
      title: 'account', icon: 'user', keepAlive: true, permission: ['user']
    },
    children: [
      {
        path: '/account/settings',
        name: 'settings',
        component: RouteView,
        meta: {
          title: 'menu.account.settings', hideHeader: true, permission: ['user'], breadcrumb: false
        },
        redirect: '/account/settings/basic',
        hideChildrenInMenu: true,
        children: [
          {
            path: '/account/settings/basic',
            name: 'BasicSettings',
            component: () => import('@/views/account/settings/Index.vue'),
            meta: { title: 'Personal center', hidden: true, permission: ['user'] }
          },
          {
            path: '/account/settings/modify/basic',
            name: 'ModifyBasicSettings',
            component: () => import('@/views/account/settings/Modify.vue'),
            meta: { title: 'Personal center', hidden: true, permission: ['user'] }
          },
          {
            path: '/account/settings/authorize',
            name: 'BasicSettingsAuthorize',
            component: () => import('@/views/account/settings/authorization/Index.vue'),
            meta: { title: 'Personal center', hidden: true, permission: ['user'] }
          }
          // {
          //   path: '/account/settings/security',
          //   name: 'SecuritySettings',
          //   component: () => import('@/views/account/settings/Security'),
          //   meta: {
          //     title: 'account.settings.menuMap.security',
          //     hidden: true,
          //     keepAlive: true,
          //     permission: ['user']
          //   }
          // },
          // {
          //   path: '/account/settings/custom',
          //   name: 'CustomSettings',
          //   component: () => import('@/views/account/settings/Custom'),
          //   meta: { title: 'account.settings.menuMap.custom', hidden: true, keepAlive: true, permission: ['user'] }
          // },
          // {
          //   path: '/account/settings/binding',
          //   name: 'BindingSettings',
          //   component: () => import('@/views/account/settings/Binding'),
          //   meta: { title: 'account.settings.menuMap.binding', hidden: true, keepAlive: true, permission: ['user'] }
          // },
          // {
          //   path: '/account/settings/notification',
          //   name: 'NotificationSettings',
          //   component: () => import('@/views/account/settings/Notification'),
          //   meta: {
          //     title: 'account.settings.menuMap.notification',
          //     hidden: true,
          //     keepAlive: true,
          //     permission: ['user']
          //   }
          // }
        ]
      }
    ]
  },
  {
    path: '*', redirect: '/404', hidden: true
  }
];
